Skip to content

Instantly share code, notes, and snippets.

@Tomalak
Tomalak / isNodeList.js
Last active May 11, 2024 15:22
A function to test if a JavaScript object is a DOM NodeList. This is designed to work across all browser implementations. StackOverflow question reference http://stackoverflow.com/a/7238344/18771.
/* Released under the MIT License in 2014. http://opensource.org/licenses/mit-license */
function isNodeList(nodes) {
var stringRepr = Object.prototype.toString.call(nodes);
return typeof nodes === 'object' &&
/^\[object (HTMLCollection|NodeList|Object)\]$/.test(stringRepr) &&
nodes.hasOwnProperty('length') &&
(nodes.length === 0 || (typeof nodes[0] === "object" && nodes[0].nodeType > 0));
}
@julianshapiro
julianshapiro / IE.js
Last active May 11, 2024 15:22
Future-Proof IE Version Detection Without User Agent Sniffing
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {
@julianshapiro
julianshapiro / RAF.js
Last active May 11, 2024 15:21
requestAnimationFrame Polyfill
var requestAnimationFrame = window.requestAnimationFrame || (function() {
var timeLast = 0;
return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
var timeCurrent = (new Date()).getTime(),
timeDelta;
/* Dynamically set the delay on a per-tick basis to more closely match 60fps. */
/* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671. */
timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));
@heroheman
heroheman / ranger-cheatsheet.md
Last active May 11, 2024 15:18
Ranger Cheatsheet

Ranger Cheatsheet

General

Shortcut Description
ranger Start Ranger
Q Quit Ranger
R Reload current directory
? Ranger Manpages / Shortcuts
@gustavomdsantos
gustavomdsantos / AutoHotKey script - Always-on-top.ahk
Last active May 11, 2024 15:18
AutoHotKey script that make any window Always-on-Top on Windows.
; Press Ctrl+Shift+Space to set any currently active window to be always on top.
; Press Ctrl+Shift+Space again set the window to no longer be always on top.
; Source: https://www.howtogeek.com/196958/the-3-best-ways-to-make-a-window-always-on-top-on-windows
^+SPACE::
WinGetTitle, activeWindow, A
if IsWindowAlwaysOnTop(activeWindow) {
notificationMessage := "The window """ . activeWindow . """ is now always on top."
notificationIcon := 16 + 1 ; No notification sound (16) + Info icon (1)
}
@Zsailer
Zsailer / schemaorg-pydantic.ipynb
Last active May 11, 2024 15:17
Define and validate schema.org structured data in Python with Pydantic
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwmiebach
kwmiebach / pytest.md
Last active May 11, 2024 15:17 — forked from amatellanes/pytest.sh
pytest cheat sheet

Usage

(Create a symlink pytest for py.test)

pytest [options] [file_or_dir] [file_or_dir] ...

Help:

@LifeJustDLC
LifeJustDLC / content.js
Created May 11, 2024 14:22
Global Speed for Android interaction design PoC
"use strict";
;
(function main() {
let truePlayRate = 1.0;
let trueCurrentTime = NaN;
const speedList = [0.8, 1.0, 1.25, 1.5, 2.0];
const isFrefox = navigator.userAgent.indexOf("Firefox") === -1 ? false : true;
const isEdge = navigator.userAgent.indexOf("EdgA") === -1 ? false : true; // yeah it's "EdgA"
let player;
const playerSize = { width: NaN, height: NaN };
@Bekbolatov
Bekbolatov / tmux.md
Last active May 11, 2024 15:12
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session